"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
// 声明一个类
// 类的属性都是实例属性 方法都是实例方法
var Dog = /** @class */ (function () {
    function Dog(name) {
        this.legs = 4; // 只读属性  这个属性是不能被更改的 要初始化
        this.name = name;
    }
    Dog.prototype.run = function () { };
    Dog.prototype.pri = function () { }; // 只能在类的本身调用 不能被实例调用  也不能被子类调用
    Dog.prototype.pro = function () { }; // 受保护成员 只能在类或子类中访问  不能被实例调用
    Dog.food = 'bones'; // 只能通过类名调用  不允许通过子类访问
    return Dog;
}());
console.log(Dog.prototype);
var dog = new Dog('wangwang');
console.log(dog);
// dog.pri()
// dog.pro()
//类的继承  子类
var Husky = /** @class */ (function (_super) {
    __extends(Husky, _super);
    function Husky(name, color) {
        var _this = _super.call(this, name) || this;
        _this.color = color;
        _this.color = color;
        // this.pri()
        _this.pro();
        return _this;
    }
    return Husky;
}(Dog));
//类的成员修饰符
//pubilc private protected  readonly static
// 抽象类与多态类
var Animal = /** @class */ (function () {
    function Animal() {
    }
    Animal.prototype.eat = function () {
        console.log('eat');
    };
    return Animal;
}());
var bird = /** @class */ (function (_super) {
    __extends(bird, _super);
    function bird(name) {
        var _this = _super.call(this) || this;
        _this.name = name;
        return _this;
    }
    bird.prototype.run = function () { };
    bird.prototype.sleep = function () {
        console.log('dog sleep');
    };
    return bird;
}(Animal));
var bird1 = new bird("hahhh");
bird1.eat();
// 多态
var Cat = /** @class */ (function (_super) {
    __extends(Cat, _super);
    function Cat() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Cat.prototype.sleep = function () {
        console.log('cat sleep');
    };
    return Cat;
}(Animal));
var cat = new Cat();
var animals = [bird1, cat];
animals.forEach(function (i) {
    i.sleep();
});
var WorkFlow = /** @class */ (function () {
    function WorkFlow() {
    }
    WorkFlow.prototype.step1 = function () {
        return this;
    };
    WorkFlow.prototype.step2 = function () {
        return this;
    };
    return WorkFlow;
}());
new WorkFlow().step1().step2();
var MyFlow = /** @class */ (function (_super) {
    __extends(MyFlow, _super);
    function MyFlow() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MyFlow.prototype.next = function () {
        return this;
    };
    return MyFlow;
}(WorkFlow));
new MyFlow().next().step1().next().step2();
